#ifndef ROOMSCENE_H_20120606
#define ROOMSCENE_H_20120606

#include "cocos2d.h"
#include "InlineFunc.h"
#include "NetworkDelegate.h"
#include "CocosUI/CocosUI.h"

enum RoomUI
{
	ROOM_BTN_FIGHT,
	ROOM_BTN_ROLE,
	ROOM_BTN_BAG,
	ROOM_BTN_FRIEND,
	ROOM_BTN_LEADERBOARD,
	ROOM_BTN_SET
};

class CRoomScene : public cocos2d::CCLayer, public CGameDelegate, CUIListener
{
public:
	LAYER_NODE_FUNC(CRoomScene);
	LAYER_SHOW_FUNC(CRoomScene);

	bool init();
	void onEnter();
	void Tick(cocos2d::ccTime dt);

	virtual void ccTouchesBegan(cocos2d::CCSet *pTouches, cocos2d::CCEvent *pEvent);
	virtual void ccTouchesMoved(cocos2d::CCSet *pTouches, cocos2d::CCEvent *pEvent);

	virtual void onReceiveMsg(int aID, int event = 0, const void *pData = NULL);

	virtual void startFightBack(bool bSuccess, const anFight &p);
	virtual void gameServerRejected();
	virtual void gameServerLost();

	void OnFinishMatch();
	void OnValid();
	
private:
	CServerHelper          *m_pServer;
	CCocosTipBox           *m_pTipBox;
	cocos2d::CCLayer       *m_pLayMain;
	cocos2d::CCPoint        m_ptLast;
	float                   m_mainX;
	bool                    m_bValid;
};
#endif